<template>
	<div class="TfullTable">
		<FullCalendar @add="add" @edit="edit" :events="tableList" ref="fullLabel"/>
	</div>
</template>

<script>
	import FullCalendar from "./compontent/index.vue";
	import api from "@/api";
	import {  parseTimeDate } from "@/utils/index.js";
	export default {
		components: {
			FullCalendar,
		},
		data(){
			return{
				tableList:[]
			}
		},
		created() {
			this.getList()
		},
		methods:{
			add(){
				this.$emit('add')
			},
			edit(info){
				this.$emit('edit',info)
			},
			/**获取列表数据 */
			getList() {
			  api.zfSchedule.list({
				  month:''
			  }).then(res => {
			    if (res.code) {
			      //设置列表数据
			      this.tableList = res.rows.map((label)=>{
					  let Tlabel = {
						title: label.scheduleTitle,
						color: label.urgencyDegree=='2'?'rgb(250, 116, 107)':label.urgencyDegree=='1'?'rgb(253, 219, 120)':'rgb(61, 212, 167)',
						textColor: '#fff',
						id:label.id,
						start: parseTimeDate(label.pstartTime),
						end: parseTimeDate(label.pendTime),
					}
					return Tlabel
				  })
				  this.$refs.fullLabel.calendarOptions.events = this.tableList;
				  this.$refs.fullLabel.fullShow = true
			    } else {
			    }
			  });
			}
		}
	};
</script>

<style lang="less">
	.TfullTable {
		.fc-toolbar-title {
			color: #276de9;
		}
		.fc-button-primary{
			background: #276de9;
			border-color:#276de9;
		}
	}
	.fc .fc-scrollgrid-liquid{
	height: 70%;
	}
	.fc-view-harness .fc-view-harness-active{
	height: 1106.4px;
	}
	.fc-scrollgrid-sync-table{
	height: 635px;
	}
</style>
